const path = require('path');
module.exports = (app) => {
    const koaStatic = require('koa-static');
    app.use(koaStatic(path.resolve(process.cwd(), './app/public')));

    const koaNunjucks = require('koa-nunjucks-2');
    app.use(koaNunjucks({
        ext: 'tpl',
        path: path.resolve(process.cwd(), './app/public'),
        nunjucksConfig: {
            noCache: true,
            trimBlocks: true,
        },
    }));

    const bodyParser = require('koa-bodyparser');
    app.use(bodyParser({
        formLimit: '1000mb',
        enableTypes: ['json', 'form', 'text'],
    }));
    app.use(app.middlewares.apiParamsVerify)
    app.use(app.middlewares.apiSignVerify)
    app.use(app.middlewares.errorHandle)
    app.use(app.middlewares.projectHandle)
}